var config = require("config");
cc.Class({
    extends: cc.Component,
    
    properties: {
        xSpeed: cc.Integer,//x轴速度
        ySpeed: cc.Integer,//y轴速度
        hpDrop: cc.Integer, //掉血
        
    },
    // use this for initialization
    onLoad: function () {
       cc.director.getCollisionManager().enabled=true;
       this.hpDrop = config.BossBulletHpDrop;
       this.ySpeed = -500;
       this.bossBulletGroup = this.node.parent.getComponent('bossBulletGroup');
    },
    //碰撞检测
    onCollisionEnter: function(other,self){
        this.bossBulletGroup.bulletDied(self.node);
    },
    // called every frame, uncomment this function to activate update callback
    update: function (dt) {
        if (this.bossBulletGroup.eState != D.commonInfo.gameState.start){
            return ;
        }
        this.node.x += dt*this.xSpeed;
        this.node.y += dt*this.ySpeed;

        if ( this.node.y> this.node.parent.height){
            this.bossBulletGroup.bulletDied(this.node);
        }
    },
    
});
